package com.selfdriving.activity;

import java.util.ArrayList;
import java.util.List;

import net.tsz.afinal.annotation.view.ViewInject;
import com.selfdriving.R;
import com.selfdriving.adapter.TravelAdapter;
import com.selfdriving.bean.Feature;
import com.selfdriving.dialog.DetailsDialog;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

public class TravelDetailsActivity extends BaseActivity {
	@ViewInject(id = R.id.topBack, click = "topBack")
	ImageView topBack;

	@ViewInject(id = R.id.topText)
	TextView topText;

	@ViewInject(id = R.id.topRight, click = "topRight")
	Button topRight;

	@ViewInject(id = R.id.travel_list)
	ListView travel_list;

	private List<Feature> features;

	private TravelAdapter adapter;

	private DetailsDialog detailsDialog;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.travel_details);
		topRight.setVisibility(View.GONE);
		topText.setText("活动信息");
		features = new ArrayList<Feature>();
		for (int i = 0; i < 10; i++) {
			Feature feature = new Feature();
			switch (i) {
			case 0:
				feature.flag = 0;
				feature.time = "第一天";
				break;
			case 1:
				feature.flag = 1;
				feature.time = "";
				break;
			case 2:
				feature.flag = 0;
				feature.time = "第二天";
				break;
			case 3:
				feature.flag = 1;
				feature.time = "";
				break;
			case 4:
				feature.flag = 0;
				feature.time = "第三天";
				break;
			case 5:
				feature.flag = 1;
				feature.time = "";
				break;
			case 6:
				feature.flag = 0;
				feature.time = "第四天";
				break;
			case 7:
				feature.flag = 1;
				feature.time = "";
				break;
			case 8:
				feature.flag = 0;
				feature.time = "第五天";
				break;
			case 9:
				feature.flag = 1;
				feature.time = "";
				break;
			default:
				break;
			}
			features.add(feature);
		}
		adapter = new TravelAdapter(this, features);
		travel_list.setAdapter(adapter);
		travel_list.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				Intent intent =new Intent(TravelDetailsActivity.this,StrategyCommentActivity.class);
				startActivity(intent);
			}
		});
	}

	public void topBack(View v) {
		this.finish();
	}

	public void feature1(View v) {
		detailsDialog.show();
	}

	public void btnChat(View v) {
		Intent intent = new Intent(this, MessageActivity.class);
		startActivity(intent);
	}
}
